package org.zachary.commonmodule.entity.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.zachary.commonmodule.entity.MqTransmissionJson;

public class JsonUtil {
    public static MqTransmissionJson deserialize(String json) {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new JavaTimeModule()); // 注册时间处理模块
        MqTransmissionJson obj=null;

        try {
            obj = mapper.readValue(json, MqTransmissionJson.class);
            System.out.println("反序列化成功!");
        } catch (Exception e) {
            System.out.println("反序列化失败,"+e.getMessage());
        }
        return obj;
    }
}
